#include "src/signalLib.h"
#include <stdio.h>
#include <windows.h>


SIGNAL_LIST_T *signal_id1;
SIGNAL_LIST_T *signal_id2;
SIGNAL_LIST_T *signal_id3;


DWORD WINAPI ThreadProc1(LPVOID lpParam)
{
    int i = 0;
    while (1) {
        signalPolling();        //100ms
        Sleep(100);
    }
}

void signal_id1_handler(){
    printf("I am signal_id1\r\n");
    signalFresh(&signal_id1,10);
}
void signal_id2_handler(){
    printf("               I am signal_id2\r\n");
    signalFresh(&signal_id2,5);
}
void signal_id3_handler(){
    printf("                              I am signal_id3\r\n");
    signalFresh(&signal_id3,2);
}

int main()
{
    CreateThread(NULL, 0, ThreadProc1, NULL, 0,  NULL);

    signalInit();
    signalRegister(&signal_id1,10,signal_id1_handler);
    signalRegister(&signal_id2,5,signal_id2_handler);
    signalRegister(&signal_id3,2,signal_id3_handler);

    signalCtrl(&signal_id1,SIG_start);
    signalCtrl(&signal_id2,SIG_start);
    signalCtrl(&signal_id3,SIG_start);
    
    while(1);
    return 0;
}

